package com.vimi8.chick.plugins.module;

import android.support.annotation.Nullable;

import com.alibaba.weex.plugin.annotation.WeexModule;
import com.eros.framework.manager.ManagerFactory;
import com.taobao.weex.annotation.JSMethod;
import com.taobao.weex.bridge.JSCallback;
import com.taobao.weex.common.WXModule;
import com.vimi8.chick.plugins.event.EventGeo;
import com.vimi8.chick.plugins.manager.AMapManager;

@WeexModule(name = "vmAMap", lazyLoad = true)
public class AMapModule extends WXModule {

    @JSMethod
    public void getLocation(String params, @Nullable final JSCallback callback) {
        EventGeo eventGeo = new EventGeo();
        eventGeo.getLocation(mWXSDKInstance.getContext(), callback);
    }

    @JSMethod
    public void getLocationOnce(String params, @Nullable final JSCallback callback) {
        EventGeo eventGeo = new EventGeo();
        eventGeo.getLocationOnce(mWXSDKInstance.getContext(), callback);
    }

    @JSMethod
    public void initAmap(final String amapKey) {
        AMapManager mGeoManager = ManagerFactory.getManagerService(AMapManager.class);
        mGeoManager.initAmap(amapKey);
    }
}
